all-list:
	g++ list/list.cpp -I./include -shared -o lib/liblist.so

clean-list:
	rm -f lib/liblist.so

all-mempool:
	g++ mempool/mempool.cpp -I./include -shared -o lib/libmempool.so

clean-mempool:
	rm -f lib/libmempool.so

all-queue:
	g++ queue/simpleQueue.cpp -I./include -shared -o lib/libqueue.so

clean-queue:
	rm -f lib/libqueue.so

all-statemachine:
	g++ statemachine/statemachine.cpp -I./include -shared -o lib/libstatemachine.so

clean-statemachine:
	rm -f lib/libstatemachine.so
    
all-tinyxml:
	g++ 3rd/tinyxml/tinystr.cpp 3rd/tinyxml/tinyxml.cpp 3rd/tinyxml/tinyxmlerror.cpp 3rd/tinyxml/tinyxmlparser.cpp -I./include/3rd/tinyxml -shared -o lib/libtinyxml.so

clean-tinyxml:
	rm -f lib/libtinyxml.so

all-test:
	g++ -g test/test.cpp -o bin/test -I./include -I./include/3rd/hiredis -L./lib -ltinyxml -lmempool -llist -lqueue -lstatemachine -lhiredis

clean-test:
	rm -f bin/test
    
all:
	make prepare
	make all-list
	make all-mempool
	make all-tinyxml
	make all-queue
	make all-statemachine
	make all-test

clean:
	make clean-list
	make clean-mempool
	make clean-tinyxml
	make clean-queue
	make clean-test
	make clean-statemachine
	rm -rf bin

prepare:
	mkdir bin
	chmod +x lib/libhiredis.so lib/libhiredis.so.0.13
